package Person.Buffer;

import java.io.*;
import java.nio.Buffer;

public class BufferStreamDEMO {
    public static void main(String[] args) throws IOException {
       // FileOutputStream fos = new FileOutputStream("IDEA\\box.txt");
       // BufferedOutputStream bos = new BufferedOutputStream(fos);
  /*      BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("C:\\Users\\win10\\IdeaProjects\\IDEA\\bos.txt"));
bos.write("hello\r\n".getBytes());
bos.write("world\r\n".getBytes());
bos.close();*/
        BufferedInputStream bis = new BufferedInputStream(new FileInputStream("C:\\Users\\win10\\IdeaProjects\\IDEA\\bos.txt"));
  /* int by;
   while((by=bis.read())!=-1){
       System.out.print((char)by);

   }
   bis.close();*/

        byte[] bys = new byte[1024];
        int len;
        while((len=bis.read(bys))!=-1){
            System.out.println(new String(bys,0,len));
        }

    }
}
